package com.JobFind.controller;

import java.io.PrintWriter;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;
import com.JobFind.logic.ICompanyLogic;
import com.JobFind.DTO.CompanyDTO;

public class CompanyController extends ActionSupport {

	private static final long serialVersionUID = 1L;
	private ICompanyLogic companyLogic;
	private CompanyDTO companyDTO;
	
	public ICompanyLogic getCompanyLogic() {
		return companyLogic;
	}
	@Resource
	public void setCompanyLogic(ICompanyLogic companyLogic) {
		this.companyLogic = companyLogic;
	}
	public CompanyDTO getCompanyDTO() {
		return companyDTO;
	}
	public void setCompanyDTO(CompanyDTO companyDTO) {
		this.companyDTO = companyDTO;
	}
    
	public void loginCheck() throws Exception{
		HttpServletResponse response = ServletActionContext.getResponse();
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		PrintWriter out=response.getWriter();
		try {
			System.out.println("yes1");
			System.out.println(companyDTO.getCompanyLoginName()+companyDTO.getCompanyPwd());
			out.println(this.companyLogic.loginCheck(companyDTO.getCompanyLoginName(), companyDTO.getCompanyPwd()));
		} catch (Exception e) {
			e.printStackTrace();
		} finally{
			out.flush();
			out.close();
		}
	}
}
